package util.android.widgets;

import util.android.ViewUtil;
import util.android.adapters.SampleTableAdapter;

import com.androidutil.R;
import com.inqbarna.tablefixheaders.TableFixHeaders;

import android.content.Context;
import android.util.AttributeSet;
import android.view.View;
import android.widget.LinearLayout;
import android.widget.TextView;

public class TablaCabeceraFijaView 
extends LinearLayout
{
	private final TextView tvPie;
	private final TableFixHeaders tabla;

	public TablaCabeceraFijaView(Context context, AttributeSet attrs) {
		super(context, attrs);
		
		LinearLayout layout = (LinearLayout) View.inflate(getContext(), R.layout.view_tabla_cabecera_fija, null);
		tabla = (TableFixHeaders) layout.findViewWithTag("tabla");
		tvPie = (TextView) layout.findViewWithTag("pie");
		
//		this.addView(layout);
		ViewUtil.addViewMatch_Wrap(this, layout);
	}
	
	public void setAdapter(SampleTableAdapter adapter) {
		tabla.setAdapter(adapter);
		tvPie.setText(adapter.getPiePagina());
	}

	public SampleTableAdapter getAdapter() {
		return (SampleTableAdapter)tabla.getAdapter();
	}
}
